home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
PROGRAMR
/
RTX2000.ZIP
/
rtx2000
/
fc
/
fc.doc
next >
Wrap
Text File
|
1993-06-08
|
45KB
|
1,531 lines
fc - A Public Domain FORTH Cross Compiler for the RTX2000
Microcontroller
Version 1.14
fc is a FORTH compiler that generates machine code for the
Harris RTX2000 microcontroller chip. fc accepts text files generated
by a text editor and produces optimized object code files for the
RTX2000. fc has options for generating annotated object code listings
and cross reference files which can be incorporated into other
programs to link variable and word definitions. fc can also be used
to produce code for the Harris RTX2010 and RTX2010 specific
instructions can be added using the #macro and ucode features.
fc currently runs on an AMIGA or IBM PC compatible computer
with either a hard disk or ram disk. fc has been tested using
AmigaDos 1.3 and MS-DOS 5.0 but, may work with other versions of
either operating system.
fc was made possible by the Public Domain version of Berkely
yacc available on Fred Fish Disk #419. Many thanks to Bob Corbett and
those who helped make this public domain version of yacc.
I would also like to thank John Goldsten and Augie Mattheiss
for their help in debugging and testing the compiler. John, Augie,
and the author have developed several programs using the MS-DOS and
AMIGA versions of the compiler that have been successfully executed on
RTX2000 target systems. We normally use the -o output option or the -
e output option for EPROMs. The EPROM output option has been
successfully used with a DATAIO UNISITE programmer.
fc is a Public Domain program so no fee should be charged for
distribution except for a possible media charge. fc was developed
using Aztec C for AMIGA version 3.6A with the default 16 bit integers.
fc has been ported to MS-DOS and the MS-DOS executable is included in
the distribution. That version is identical to the AMIGA version
except for some details pertaining to memory allocation and the naming
of some of the source file names. An experimental Macintosh version
may also be included in the distribution and it will require MPW.
fc is currently being used for software development future
revisions are likely. We already have had several months experience
producing and executing code generated by fc. However, fc is offered
"as is" and will not necessarily be supported. Anyone wishing to
develop large programs for the RTX2000 or RTX2010 may wish to look
into other development systems or cross compilers from one of the
several vendors marketing them.
A test file is included with the distribution to demonstrate
code production of the compiler. This output has been checked against
the instruction set listed in the Harris RTX2000 Programmer's
Reference Manual. However, users should check the code production in
a disassembly output should they run into any really puzzling problems
when debugging their programs. We have developed several programs up
to 4K bytes long and have not run into any code production problems
for the last couple of months.
Background
The RTX2000 microcontroller is a 16 bit microprocessor
architectureally designed for executing the FORTH language. The
RTX2000 instruction set corresponds to FORTH primitive words (like
SWAP, DROP, @, !, etc) and combinations of primitive words which, in
some cases, allow several FORTH instructions to be encoded into a
single RTX2000 instruction. All RTX2000 instructions execute in one
or two cycles and are sixteen or thirty-two bits long. It is common
to run the RTX2000 at rates of 8MHz to 10MHz making it fast for real
time control applications.
The RTX2000 chip includes two onboard stacks (256 deep), one is
used for parameters and the other is used mainly for subroutine
returns. This allows stack operations like SWAP, DROP, etc, to be
performed without an external memory access. Likewise subroutine
returns are done using the onboard return stack making subroutine
overhead quite low. In fact, most RTX2000 instructions can be coded
to perform a return as part of the instruction so, returns often don't
even require any extra code.
The RTX2000 has several onboard peripherals, including three
timer/counters and an interrupt controller. For more information on
the RTX2000, consult the data sheet from Harris semiconductor.
Potential users are strongly advised to investigate Harris' plan for
future support of the RTX2000 family before committing to the chip.
fc should also be compatible with the Harris RTX2010RH which is
sold as an ASIC. The RTX2010RH features higher radiation tolerance
then the RTX2000, a barrel shifter, and a multiply accumulate circuit.
Support for RTX2010 specific instructions can be added by using the
macro capability of fc.
Running fc
fc is invoked from the CLI (AMIGA) or MS-DOS by typing:
fc {-lreoxsd} {iaaa} {-tbbb} filename
fc recognizes nine command line options - l, x, e, o, r, s, d, i and
t. The l, x, s, d, i, and t options can be used in any combination
along with one of the other three options. All options must proceed
the source file name. The source file name is used as the base name
for generating output files. If the source file has an extension, the
extension is removed when forming the output file names.
The l option writes a disassembled listing of the program into
a file named filename.lst. The e option produces two EPROM output
files named filename.low and filename.hi instead of the default object
code output. The r option also generates EPROM files, but the data is
in a nonstandard bit shuffled format. The o option produces an
ascii/hex output file named filename.ols. The x option generates a
definition file named filename.x which can be used by other programs
to access words and variables in the compiled program. The s option
prints a symbol table into filename.sym. The d option turns on the
conditional compilation. The i option specifies a directory for
include files. Finally, the t option specifies a directory for
temporary files.
The l option generates an object code listing along with the
corresponding FORTH source code. This allows the programmer to check
how well the code was optimized. Often a fc listing file will include
a single line with thirty-two bits of code. This is done for long
literal instructions (which are 32 bits long) and when optimizations
bail-out due to a missing key instruction (often an alu operation,
fetch, or store). The listing file also includes any error messages.
The e option generates object code for hi and low byte EPROMs.
The output format is ASCII/HEX compatible with DATAIO format 51 (or
56) and is produced only if no errors occurred during compilation.
This format consists of a start code, one or more address declarations
and data blocks, followed by a stop code and checksum. After
compilation, fc will query the user for the EPROM base address. This
address is subtracted from the code address to produce an EPROM
relative address for output files. (If EPROMs are at 0x8000 hex, and
code starts at 0x8a00, the EPROM files would have address 0xa00 hex)
The r option generates the same type of files except the data for each
byte is bit reversed.
The o option generates object code in an ascii/hex format that
is compatible with the load block format described later. Each 16 bit
entity in the output file is represented by a four digit hexadecimal
number. The format consists of a configuration number (equal to the
compiler version), start address, data word count, control checksum,
object code, and block checksum. As with the other output formats,
code is only produced if there are no compilation errors.
The x option produces a file with information about the symbols
used in the program. This information includes the address of all
defined words and variables that are